package cn.xdmnb.cloud.blog.plugin.web.util;

import cn.xdmnb.cloud.blog.core.dict.ResultCode;
import cn.xdmnb.cloud.blog.plugin.web.exception.ServiceException;

/**
 * @author yukai
 * @since 2023年01月05日 22:55
 */
public class AssertUtil {

    public static void assertTrue(boolean flag){
        if (!flag)
            throw new ServiceException(ResultCode.SERVICE_EXCEPTION.getCode(),ResultCode.SERVICE_EXCEPTION.getMsg());
    }

    public static void assertTrue(boolean flag,ResultCode resultCode){
        if (!flag)
            throw new ServiceException(resultCode.getCode(),resultCode.getMsg());
    }

    public static void assertTrue(boolean flag,Integer code,String msg){
        if (!flag)
            throw new ServiceException(code,msg);
    }

}
